package cn.tedu.egweibo2.base.response;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
public class JsonResult {
    private Integer state;
    private String message;
    private Object data;

    public JsonResult(Status status){
        this.state = status.getState();
        this.message = status.getMessage();
    }
    public JsonResult(Status status,Object data){
        this.state = status.getState();
        this.message = status.getMessage();
        this.data = data;
    }
    public static JsonResult ok(Object date){
        return new JsonResult(Status.OPERATION_SUCCESS,date);
    }
    public static JsonResult ok(){
        // return new JsonResult(StatusCode.OPERATION_SUCCESS);
        return ok(null);
    }
}
